<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>在线考试平台</title>
    <link rel="shortcut icon" href="static/layui/images/exam.png" type="image/x-icon">
    <link rel="stylesheet" href="static/layui/css/font.css">
    <link rel="stylesheet" href="static/layui/css/xadmin.css">
    <script src="static/layui/lib/layui/layui.js"></script>
    <script src="static/layui/js/xadmin.js"></script>
    <script src="static/layui/js/jquery.min.js"></script>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <blockquote class="layui-elem-quote">欢迎管理员：
                        <span class="x-red" id="user_name"></span>
                    </blockquote>
                </div>
            </div>
        </div>
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">数据统计</div>
                <div class="layui-card-body ">
                    <ul class="layui-row layui-col-space10 layui-this x-admin-carousel x-admin-backlog">
                        <li class="layui-col-md2 layui-col-xs6">
                            <a href="javascript:;" class="x-admin-backlog-body">
                                <h3>单选题库</h3>
                                <p>
                                    <cite id="cq_num"></cite></p>
                            </a>
                        </li>
                        <li class="layui-col-md2 layui-col-xs6">
                            <a href="javascript:;" class="x-admin-backlog-body">
                                <h3>判断题库</h3>
                                <p>
                                    <cite id="jq_num"></cite></p>
                            </a>
                        </li>
                        <li class="layui-col-md2 layui-col-xs6">
                            <a href="javascript:;" class="x-admin-backlog-body">
                                <h3>简答题库</h3>
                                <p>
                                    <cite id="saq_num"></cite></p>
                            </a>
                        </li>
                        <li class="layui-col-md2 layui-col-xs6">
                            <a href="javascript:;" class="x-admin-backlog-body">
                                <h3>试卷数</h3>
                                <p>
                                    <cite id="paper_num"></cite></p>
                            </a>
                        </li>
                        <li class="layui-col-md2 layui-col-xs6">
                            <a href="javascript:;" class="x-admin-backlog-body">
                                <h3>学习资源</h3>
                                <p>
                                    <cite id="resource"></cite></p>
                            </a>
                        </li>
                        <li class="layui-col-md2 layui-col-xs6 ">
                            <a href="javascript:;" class="x-admin-backlog-body">
                                <h3>用户数</h3>
                                <p>
                                    <cite id="user_num"></cite></p>
                            </a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">系统信息</div>
                <div class="layui-card-body ">
                    <table class="layui-table">
                        <tbody>
                        <tr>
                            <th>在线考试平台版本</th>
                            <td>v1.0</td>
                        </tr>
                        <tr>
                            <th>服务器地址</th>
                            <td>http://localhost:8080/exam_system/</td>
                        </tr>
                        <tr>
                            <th>操作系统</th>
                            <td>Windows10</td>
                        </tr>
                        <tr>
                            <th>运行环境</th>
                            <td>Win64/IDEA2020.2</td>
                        </tr>
                        <tr>
                            <th>jdk版本</th>
                            <td>1.8</td>
                        </tr>
                        <tr>
                            <th>MySQL</th>
                            <td>8.0</td>
                        </tr>
                        <tr>
                            <th>Tomcat</th>
                            <td>9.0</td>
                        </tr>
                        <tr>
                            <th>上传附件限制</th>
                            <td>2M</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">开发团队</div>
                <div class="layui-card-body ">
                    <table class="layui-table">
                        <tbody>
                        <tr>
                            <th>版权所有</th>
                            <td>mjl</td>
                        </tr>
                        <tr>
                            <th>开发者</th>
                            <td>mjl</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    layui.use(['element', "form", 'jquery', 'layer'], function () {
        const form = layui.form;
        const $ = layui.jquery;
        const layer = layui.layer;
        const element = layui.element;
        var user_json = JSON.parse(sessionStorage.getItem("userJson"));
        $("#user_name").html(user_json.u_name);

        system_data();
    });

    function system_data(){
        $.ajax({
            url: 'system_data',
            dataType: "json",//数据格式
            type: "post",//请求方式
            async: false,//是否异步请求
            success: function (data) {
                if (data.code === 200) {
                    $("#cq_num").text(data.result.cq_num);
                    $("#jq_num").text(data.result.jq_num);
                    $("#saq_num").text(data.result.saq_num);
                    $("#paper_num").text(data.result.paper_num);
                    $("#user_num").text(data.result.user_num);
                    $("#resource").text(data.result.resource);
                }
            },
            error: function (e) {
                alert("出现错误！！");
            }
        });
    }

</script>
</html>